Managed runtime computing environments (runtime environments) are available for a variety of different object-oriented programming languages, for example, Java™ and C#. Java™ is commonly used with the Java™ Runtime Environment (JRE) available from Sun Microsystems, Inc. of Santa Clara, Calif. C# is commonly used within the .NET Framework available from Microsoft Corporation of Redmond, Wash.
Within a runtime environment, program code can be loaded dynamically at runtime. That is, while a program is executing within the runtime environment, further program code can be dynamically loaded into the runtime environment and executed. For example, when loading a class in Java™ the data representing the class can be loaded and read. An internal object representing the class can be created within the runtime environment. Once created, the class object can be registered with the runtime environment.
In some cases, data representing a class is stored as compiled code within a file. In other cases, data representing a class can be stored at a remote location and loaded over a communication network, e.g., using Hypertext Transfer Protocol (HTTP), or loaded from a database via a database query operation. In still other cases, the data representing a class may be in some non-standard data format, requiring preprocessing during the loading and reading process. In Java™ for example, this flexibility exists because developers are permitted to create customized classloaders.
The ability to dynamically load program code within a runtime environment facilitates dynamic code generation. Rather than dynamically load compiled code, source code can be dynamically generated. The source code can be processed into binary code. A class object can be created from the binary code. Taking the JRE as an example, source data can be located, read, and compiled into a form that is usable in creating the class object. The data can be used to create an internal object representing the class within the JRE. The class object can be registered with the JRE and executed.
While the above scenario provides for a high level of system flexibility, processing source code “on-the-fly,” e.g., at runtime, can be time consuming and computing resource intensive. In some instances, the time needed for processing source code can rival or surpass the time needed for performing each of the other tasks needed to implement the object class within the runtime environment combined. Dynamic processing of source code is but one example. The involvement of a preprocessing step before data can be used within a runtime environment generally imposes a penalty in terms of computing resources and time.